package red.mlz.module.module.game.es;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

public interface GameEsRepository extends ElasticsearchRepository<GameEs, Long> {

    @Query("{\"bool\": {\"should\": [" +
            "{\"match\": {\"gameName\": \"?0\"}}, " +
            "{\"match\": {\"categoryName\": \"?0\"}}, " +
            "{\"match\": {\"tagNames\": \"?0\"}}" +
            "]}}")
    Page<GameEs> searchByKeyword(String keyword, Pageable pageable);

    Page<GameEs> findAll(Pageable pageable);
}
